﻿using System;
using System.Windows;

namespace Oxage.CNC
{
	public class GeometryHelper
	{
		public static double DegreesToRadians(double deg)
		{
			return Math.PI * deg / 180d;
		}

		public static double RadiansToDegrees(double rad)
		{
			return rad * 180d / Math.PI;
		}

		public static double Angle(Point p1, Point p2)
		{
			double a1 = Math.Atan2(p1.Y, p1.X);
			double a2 = Math.Atan2(p2.Y, p2.X);
			double angle = a1 - a2;
			if (p1.Y - p2.Y < 0)
			{
				angle = 2 * Math.PI + angle;
			}
			return angle;
		}
	}
}
